<template>
  <div>
    <div class="">
      <el-row>
        <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10">
          <div class="detail_info">
            <div style="margin: 25px 20px 0px 25px">
              <img :src="info.zxlogo" alt="" style="
                  width: 58px;
                  height: 58px;
                  border: 1px solid #cbc5c5;
                  border-radius: 8px;
                " />
            </div>
            <div style="margin-top: 16px;">
              <span class="detail_title">{{ info.nickname }}</span>
              <div class="detail_text">
                <span>{{ info.mini_version }}</span>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :xs="24" :sm="14" :md="14" :lg="14" :xl="14">
          <div class="but_count">
            <el-button type="button" class="preview" @click="showDownPage()">预览</el-button>
            <el-button type="button" class="upnew" @click="gotoUploadNew()">上传新版本</el-button>
          </div>
        </el-col>
      </el-row>
    </div>

    <table class="table" style="margin-top: 43px; margin-bottom:100px;">
      <thead>
        <tr class="row">
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">包名（BundleID）</div>
            <div class="datas">
              <template>
                <div style="display: flex; align-items: center">
                  <div class="copy">
                    {{ info.hpackageName }}
                  </div>
                  <el-button type="text" style="margin-left: 5px" v-clipboard:copy="info.hpackageName"
                    v-clipboard:success="onCopy" v-clipboard:error="onError">复制</el-button>
                </div>
              </template>
            </div>
          </th>
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">状态</div>
            <div class="datas">
              <template>
                <div style="display: flex; align-items: center">
                  <div class="copy" style="line-height:35px;">
                    {{ info.status | appStatus }}
                  </div>
                </div>
              </template>
            </div>
          </th>
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">下载链接</div>
            <div class="datas">
              <template>
                <div style="display: flex; align-items: center">
                  <div class="copy" style="line-height:35px;">
                    <a :href="info.down_url" target="_blank">{{ info.down_url }}</a>
                  </div>
                </div>
              </template>
            </div>
          </th>
        </tr>
        <tr class="row">
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">公司名称</div>
            <div class="datas">
              <template>
                <div style="display: flex; align-items: center">
                  <div class="copy">无</div>
                  <el-button type="text" style="margin-left: 5px">复制</el-button>
                </div>
              </template>
            </div>
          </th>
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">集团信息</div>
            <div class="datas" style="padding-top: 10px"></div>
          </th>
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">签名期限</div>
            <div class="datas" style="padding-top: 10px">
              {{ info.super_endtime }}
            </div>
          </th>
        </tr>
        <tr class="row">
          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">下载次数</div>
            <div class="datas" style="padding-top: 10px">
              {{ info.xznum }}次
            </div>
          </th>

          <th class="col-md-4 col-xs-12">
            <div class="ner"></div>
            <div class="title">下载二维码</div>
            <div class="datas" style="padding-top: 10px">
              <!-- 鼠标hover，放大图片 -->
              看右边<span class="imgHoverZoom">
                <img :src="info.erweima" alt="" style="
                    width: 36px;
                    height: 36px;
                    margin-left: 40px;
                    margin-top: -20px;
                  " /></span>
            </div>
          </th>
        </tr>
      </thead>
    </table>
  </div>
</template>

<script>
  import filters from "../../../utils/filters";
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    filters: filters,
    data() {
      //这里存放数据
      return {
        appUrl: "../../../static/App图标.png",
        info: [],
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
      getList() {
        var params = new URLSearchParams();
        params.append("appid", this.$route.query.appID);
        this.$post(this.API.Application_detail, params).then((res) => {
          let data = res.data;
          this.info = data.info;
        });
      },
      goUrl(path, name) {
        sessionStorage.setItem("currentTab", "first");
        this.$router.push({
          path: path,
          name: name,
        });
      },
      // 复制成功
      onCopy(e) {
        // console.log(e);
        this.$message({
          type: "success",
          message: "复制成功!",
        });
      },
      // 复制失败
      onError(e) {
        alert("失败");
      },
      //上传新版本
      gotoUploadNew() {
        let appID = this.$route.query.appID;
        this.$router.push({
          path: "adhibition",
          name: "adhibition",
          query: {
            appID: appID,
          },
        });

        window.scrollTo(0, 0);
        sessionStorage.setItem("currentTab_title", "adhibition");
        sessionStorage.setItem("setMenuIndex_firm", 0); //设置我的应用左侧菜单选中项
        location.reload();
      },
      //预览
      showDownPage() {
        let down_url = this.info.down_url;
        window.open(down_url, '_blank');
      },
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {
      this.getList();
    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {},
  };

</script>
<style scoped>
  .copy {
    width: 200px;
    overflow: hidden;
    /*设置超出的部分进行影藏*/
    text-overflow: ellipsis;
    /*设置超出部分使用省略号*/
    white-space: nowrap;
    /*设置为单行*/
  }

  .ner {
    width: 4px;
    height: 14px;
    background: #ff7226;
    border-radius: 2px;
    position: absolute;
    margin-left: -8px;
    margin-top: 1px;
  }

  .title {
    height: 14px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #000000;
    line-height: 14px;
  }

  .datas {
    height: 14px;
    font-size: 14px;
    font-family: PingFang-SC-Regular, PingFang-SC;
    font-weight: 400;
    color: #c4c8d0;
    line-height: 14px;
  }

  .orderHeader {
    display: flex;
    justify-content: space-between;
    height: 80px;
    padding: 18px 20px;
  }

  .flexJustifyStart {
    display: flex;
    justify-content: start;
    align-items: center;
  }

  .block>>>.el-date-editor .el-range__icon {
    margin-left: -5px !important;
    line-height: 18px !important;
  }

  .orderHeader>>>.el-form-item__content {
    line-height: 40px !important;
  }

  .flexAlginCenter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    width: 100%;
  }

  .orderBody {
    height: 550px;
  }

  >>>.el-card {
    border: none;
  }

  >>>.el-progress-bar {
    width: 200px;
  }

  /* 按钮 */
  .buy {
    background: -webkit-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: -o-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: -moz-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: linear-gradient(-135deg, #ff9d68, #ff7226);
    color: #fff;
    font-size: 16px;
  }

  .cell span {
    width: 1px;
    /*根据自己项目进行定义宽度*/
    overflow: hidden;
    /*设置超出的部分进行影藏*/
    text-overflow: ellipsis;
    /*设置超出部分使用省略号*/
    white-space: nowrap;
    /*设置为单行*/
  }

  .box1 {
    width: 100px;
    height: 50px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    /* border-right: 1px solid #E0E0E0; */
  }

  .box1:first-child {
    border-right: 1px solid #e0e0e0;
  }

  .box2 {
    margin: 0px 20px;
  }

  .detail_info {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .detail_title {
    width: 36px;
    height: 18px;
    font-size: 18px;
    font-family: PingFang-SC-Medium, PingFang-SC;
    font-weight: 500;
    color: #000000;
    
  }

  .detail_text {
    height: 12px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #cbc5c5;
    margin-top: 5px;
  }

  .detail_text span:first-child {
    margin-left: 0px;
  }

  .detail_text span {
    margin-left: 22px;
  }

  .table>thead>tr>th {
    padding: 8px 0px 30px 30px !important;
    border: none;
  }

  div>>>.preview,
  .merge {
    border: 2px solid #ff7226;
    color: #ff7226;
  }

  .preview:hover {
    background-color: #ff7226;
    color: #fff;
  }

  .upnew:hover {
    border: 2px solid #167df1;
    background-color: #fff;
    color: #167df1;
  }

  .upnew {
    border: 2px solid #167df1;
    background-color: #167df1;
    color: #fff;
  }

  table {
    margin-left: 20px;
  }

  a {
    text-decoration: none;
    cursor: pointer
  }

  a:hover {
    cursor: pointer
  }

  /* 鼠标hover，放大图片 */
  .imgHoverZoom img {
    height: 150px;
    -webkit-transition: -webkit-transform .3s ease;
    -moz-transition: -moz-transform .3s ease;
    -ms-transition: -ms-transform .3s ease;
    transition: transform .3s ease;
  }

  .imgHoverZoom img:hover {
    -webkit-transform: scale(4.2);
    -moz-transform: scale(4.2);
    -ms-transform: scale(4.2);
    transform: scale(4.2)
  }

  .but_count {
    display: flex;
    justify-content: flex-end;
    margin-right: 20px;
    margin-top: 30px;
  }

  /* 媒体查询 */
  @media (max-width: 992px) {
    .count {
      margin-top: 20px;
      font-size: 14px;
    }
  }

  @media (max-width: 768px) {
    .but_count {
      display: flex;
      justify-content: flex-start;
      margin-left: 20px;
      margin-bottom: -20px;
    }

    .count {
      margin-top: 20px;
      font-size: 14px;
    }

    .data2 {
      margin-top: 20px;
    }

    .select_but {
      margin-top: 20px;
    }
  }

  @media (max-width: 576px) {
    .but_count {
      display: flex;
      justify-content: flex-start;
      margin-left: 28px;
      margin-bottom: -20px;
    }

    .select_but {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 20px;
    }

    .count {
      margin-top: 20px;
      font-size: 14px;
    }

    .data2 {
      margin-top: 20px;
    }

  }

  @media (max-width: 414px) {
    .but_count {
      display: flex;
      justify-content: center;
      margin-bottom: -20px;
      margin-left: -140px;
    }

    .el-button {
      padding: 8px 15px;
    }

  }

  @media (max-width: 375px) {
    .but_count {

      margin-bottom: -20px;
      margin-left: -100px;
    }

    .el-button {
      padding: 8px 15px;
    }

  }

</style>
